// $(function () {
    // var sendData = {};
    var url = "http://127.0.0.1:8888/linkMan/linkman/uploadFile";

    var obj = {
        init: function () {

            this.initInputFile(url, "myfile");
        },
        events: {

        },
        initInputFile2: function () {

        },
        initInputFile: function (url, ele) {
            $("#" + ele).fileinput({
                uploadUrl: url, //上传的地址
                uploadAsync: true, //默认异步上传
                showUpload: true, //是否显示上传按钮,跟随文本框的那个
                showRemove: true, //显示移除按钮,跟随文本框的那个
                showCaption: true, //是否显示标题,就是那个文本框
                showPreview: true, //是否显示预览,不写默认为true
                dropZoneEnabled: true, //是否显示拖拽区域，默认不写为true，但是会占用很大区域
                maxFileCount: 9, //表示允许同时上传的最大文件个数
                enctype: 'multipart/form-data',
                validateInitialCount: true,
                previewFileIcon: "<i class='glyphicon glyphicon-king'></i>",
                msgFilesTooMany: "选择上传的文件数量({n}) 超过允许的最大数值{m}！",
                allowedFileTypes: ['image'], //配置允许文件上传的类型
                allowedPreviewTypes: ['image'], //配置所有的被预览文件类型
                allowedPreviewMimeTypes: ['jpg', 'png', 'gif', 'bmp','svg'], //控制被预览的所有mime类型
                language: 'zh',
                uploadExtraData: function (previewId, index) { //额外参数的关键点
                    var sendData = {};
                    sendData.id = "11001";
                    // sendData.name = $("#username").val();
                    sendData.name = "huacx";
                    console.log("sendData:", sendData);
                    // obj.fodder = fodderType();
                    // console.log(obj);
                    return sendData;
                }
            }).on('fileuploaded', function (event, data, previewId, index, fileId) {
                console.log("fileuploaded data: ", data.response)
            }).on('fileuploaderror', function (event, data, msg) {

            }).on('filebatchuploadcomplete', function (event, preview, config, tags,
                extraData) {

            }).on("filebatchselected", function (event, files) {
                console.log(" filebatchselected change")
            }).on("fileimageuploaded", function (params) {
                console.log(" fileimageuploaded end");
            }).on('filebatchuploaderror', function (event, data, msg) { //同步上传错误处理
                console.log("filebatchuploaderror");
            }).on("filebatchuploadsuccess", function (event, data, previewId, index) {
                console.log("filebatchuploadsuccess");
            }).on('filepreupload', function (event, data, previewId, index) {
                console.log("filepreupload");
            });
        },
        buttonSubmit: function () {
            $("#upfile").fileinput("upload");
        }
    }
    obj.init();
// })